//
//  NSTimer+Ex.m
//  iOSCodeLearning
//
//  Created by TFAppleWork-Summer on 2018/4/9.
//  Copyright © 2018年 Ace. All rights reserved.
//

#import "NSTimer+Ex.h"

@implementation NSTimer (Ex)

+(NSTimer *)cc_scheduledTimerWithTimeInterval:(NSTimeInterval)time repeats:(BOOL)repets block:(void (^)(void))block{
    
    NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:time
                                                      target:self
                                                    selector:@selector(cc_blockInvoke:)
                                                    userInfo:[block copy]
                                                     repeats:repets];
    return timer;
    
}

+(void)cc_blockInvoke:(NSTimer *)timer{
    
    void(^timerBlock)(void) = timer.userInfo;
    if (timerBlock) {
        timerBlock();
    }
}
@end
